import { useCartStore } from '@/stores/cart'
import { Toast } from 'vant'
import { useRouter } from 'vue-router'

export const useCart = ()=>{
    const cartStore = useCartStore()
    const router = useRouter()

    const bindBack = ()=> router.replace({path:'/'}) 
    /**
     * 删除
     *   
     */
    const bindDelete = (id:number)=>{
        cartStore.deleteGoods(id)
    }

    /**
     * 提交订单
     */
    const bindOrderSubmit = ()=>{

    }

    return {cartStore,bindBack,bindDelete,bindOrderSubmit}
}